"use strict";
cc._RF.push(module, '968433JkFxNfo6gRoAdJ/pL', 'Coin');
// script/Coin.js

"use strict";

/**
 * 金币道具和地雷道具
 */
cc.Class({
    extends: cc.Component,

    properties: {},

    // onLoad() { },
    // 只在两个碰撞体开始接触时被调用一次
    onBeginContact: function onBeginContact(contact, selfCollider, otherCollider) {
        //地雷
        if (selfCollider.tag === 11) {
            selfCollider.node.getComponent(cc.Animation).stop();
            selfCollider.node.getComponent(cc.Animation).play("mineBoom");
        }
        //金币
        if (selfCollider.tag === 2) {
            //金币总数加一，播放金币消失动画和关闭金币的碰撞监听
            cc.vv.CoinCount += 1;
            cc.log("当前金币数" + cc.vv.CoinCount);
            selfCollider.node.getComponent(cc.Animation).play("coinBoom");
            selfCollider.node.getComponent(cc.RigidBody).enabledContactListener = false;
        }
    },
    /**
     * 金币和地雷动画播放完成时删除此节点
     */
    onCoinBoomFinished: function onCoinBoomFinished() {
        this.node.destroy();
    },

    // 只在两个碰撞体结束接触时被调用一次
    onEndContact: function onEndContact(contact, selfCollider, otherCollider) {},

    // 每次将要处理碰撞体接触逻辑时被调用
    onPreSolve: function onPreSolve(contact, selfCollider, otherCollider) {},

    // 每次处理完碰撞体接触逻辑时被调用
    onPostSolve: function onPostSolve(contact, selfCollider, otherCollider) {}
    // start () {},

    // update (dt) {},
});

cc._RF.pop();